fix: remove stale fee snapshot from BotFactory and reduce minFeePadding to 10x#21464
Draft
fix: remove stale fee snapshot from BotFactory and reduce minFeePadding to 10x#21464
Conversation
…ng to 10x The BotFactory was snapshotting maxFeesPerGas once during account setup, then using that stale value for the deployment tx. By the time the tx was processed, L1 baseFee had escalated (due to rapid block building on anvil), causing the tx to be rejected. Instead of snapshotting fees, let the wallet re-estimate at send() time via completeFeeOptions(), which uses the configured minFeePadding. This makes the fee estimate fresh and a 10x padding sufficient. Changes: - Remove explicit maxFeesPerGas snapshot from setupAccountWithPrivateKey - Let wallet.completeFeeOptions() estimate fees at send time - Reduce minFeePadding from 99 (100x) back to 9 (10x) in bridge resume tests
ludamad
added a commit
that referenced
this pull request
Mar 13, 2026
#20992 #21148) (#21465) ## Summary Backports three fixes from `next` and adds a fourth to stabilize the flaky `e2e_bot` test on `v4-next`. **Root cause:** The `BotFactory` was snapshotting `maxFeesPerGas` once during account setup, then using that stale value for subsequent transactions. L1 baseFee escalation on anvil (from rapid block building) caused fees to exceed the stale cap. ### Changes 1. **BotFactory constructor sets wallet fee padding** (backport of #20992) - Calls `wallet.setMinFeePadding(config.minFeePadding)` so all setup transactions use the configured padding instead of the wallet default (0.5x) 2. **GasFees.mul() precision fix** (backport of #20962) - Uses bigint arithmetic for integer scalars to avoid precision loss - Uses `Math.ceil` for non-integer scalars to ensure fees always round up 3. **Dedicated L1 account for bridge resume tests** (backport of #21148) - Uses private key index 7 instead of the default mnemonic (shared with the sequencer) - Avoids nonce races on approve/deposit calls in `bridgeL1FeeJuice` - Uses `getPrivateKey()` helper with auto-incrementing index for other tests 4. **Remove stale fee snapshot** (new, also in #21464 on `next`) - Removes explicit `maxFeesPerGas` snapshot from `setupAccountWithPrivateKey` - Lets the wallet re-estimate fees at `send()` time via `completeFeeOptions()` - Fresh estimation + 10x padding is sufficient since fee change within 1 block is minimal Related: A-648, #21453 ClaudeBox log: https://claudebox.work/s/c64a6207b95c4a16?run=4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the flaky
e2e_bottest ("does not reuse prior bridge claims if recipient address changes") by addressing the root cause instead of increasing fee padding.Root cause:
BotFactory.setupAccountWithPrivateKey()was snapshottingmaxFeesPerGasonce at setup time (factory.ts:225), then baking it intogasSettings. By the time the sequencer processed the tx (many blocks later), anvil's L1 baseFee had escalated due to rapid block building, causinggasFees.feePerL2Gas > maxFeesPerGas.feePerL2Gas.Fix:
maxFeesPerGassnapshot fromsetupAccountWithPrivateKeycompleteFeeOptions()estimate fees atsend()time using the configuredminFeePadding(already set in the constructor via PR fix: set wallet minFeePadding in BotFactory constructor #20992)minFeePaddingfrom 99 (100x) back to 9 (10x) in bridge resume tests — now sufficient since fees are estimated moments before sendingRelated: A-648
Context
ClaudeBox log: https://claudebox.work/s/c64a6207b95c4a16?run=4